<template>
	<div class="login">
		<div class="logo"><img src="@/assets/img/logo.png" /></div>
		<div class="main">
			<h2>网络模块更新</h2>
			<div class="box">
				<el-form :model="elForm" ref="elForm">
					<el-form-item :rules="FormRule.NotNull" prop="username">
						<el-input @keyup.enter.native="login" clearable placeholder="用户名" v-model.number="elForm.username"></el-input>
					</el-form-item>
					<el-form-item :rules="FormRule.password" prop="password">
						<el-input @keyup.enter.native="login" clearable placeholder="密码" type="password" v-model.trim="elForm.password"></el-input>
					</el-form-item>
					<el-form-item><el-button @click="login" class="btn" type="primary">登录</el-button></el-form-item>
				</el-form>
			</div>
		</div>
		<div class="copyright">
			<p>版权所有 北京迪文科技有限公司</p>
			<a href="http://www.beian.miit.gov.cn" target="_blank">京ICP备05033781号-5</a>
		</div>
	</div>
</template>
<script>
export default {
	name: 'login',
	data() {
		return {
			elForm: {
				username: '13100000689',
				password: '123456'
			}
		};
	},
	created() {},
	methods: {
		GetLogin() {
			this.$router.push({
				path: '/material'
			});
			return;
			this.$api
				.Login({
					username: this.elForm.username,
					password: this.$md5(this.elForm.password)
				})
				.then(data => {
					if (data.code == 0) {
						this.$store.mutations.user(data.data);
						this.$router.push({
							path: '/material'
						});
					}
				});
		},
		login() {
			this.$refs['elForm'].validate(valid => {
				if (valid) {
					this.GetLogin();
				} else {
					return false;
				}
			});
		}
	}
};
</script>
<style>
@import '~@/assets/css/login.css';
</style>
